<template>
  <div id="app">
    <button @click="setSession">1</button>
    <button @click="getSession">2</button>
  </div>
</template>

<script>
import axios from 'axios';  
export default {
  name: 'App',
  methods: {
                async setSession() {
                    const res = await axios({
                        url:"http://192.168.2.147:8081/test/set",
                        // url:"http://127.0.0.1:8081/test/set",
                        method: 'GET', // 虽然 GET 是默认方法，但明确指定是个好习惯  
                        withCredentials: true, // 如果需要发送 Cookie，请启用此选项
                    });
                    console.log(res);
                },
                async getSession() {
                    const res = await axios({
                        // url:"http://127.0.0.1:8081/test/get",
                        url:"http://192.168.2.147:8081/test/get",
                        method: 'GET', // 虽然 GET 是默认方法，但明确指定是个好习惯  
                        withCredentials: true, // 如果需要发送 Cookie，请启用此选项
                    });
                    console.log(res);
                }
            },
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
